import 'package:cbec_app/app.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class UsageBottomSheetWidget extends StatelessWidget {
  final String title;
  final String content;

  const UsageBottomSheetWidget({super.key, required this.title, required this.content});

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.only(top: 0, bottom: ScreenUtil().bottomBarHeight, left: 16, right: 16), // 增加底部间距
      height: 500, // 设置弹窗高度
      width: double.infinity,
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            children: [
              Text(
                title,
                style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
              ),

              const Spacer(), // 使内容上移
              IconButton(
                onPressed: () {
                  Navigator.pop(context); // 关闭弹窗
                },
                icon: const Icon(
                  Icons.close,
                  color: Colors.black,
                ),
              ),
            ],
          ),
          const SizedBox(height: 20),
          Text(content),
        ],
      ),
    );
  }
}

void showUsageBottomSheet(BuildContext context, String title, String content) {
  showModalBottomSheet(
    context: context,
    builder: (BuildContext context) {
      return UsageBottomSheetWidget(title: title, content: content);
    },
  );
}
